//
//  PQPreparedStatement.m
//  ObjectivePQ
//
//  Created by Ian Michell on 01/07/2007.
//  Copyright 2007 Ian Michell. All rights reserved.
//

#import "PQPreparedStatement.h"
#import "DBConnection.h"

// Used as a c++ friend style hack ;)
@interface PQConnection (PQPreparedStatement)
- (PGconn*) getPGConnection;
@end

@implementation PQConnection (PQPreparedStatement)
- (PGconn*) getPGConnection
{
	return self->connection;
}
@end

// This will allow us to access a native result set object
@interface PQResultSet (PQPreparedStatement)
- (PQResultSet*) initWithNativeResult: (PGresult*) r;
@end

@implementation PQResultSet (PQPreparedStatement)
- (PQResultSet*) initWithNativeResult: (PGresult*) r
{
	self = [super init];
	if (self)
	{
		self->res = r;
		self->currentRow = -1;
	}
	return self;
}
@end

@implementation PQPreparedStatement
//==============================================================================
// Query Methods
//==============================================================================
- (bool) execute
{
	return FALSE;
}

//==============================================================================
// Query Methods
//==============================================================================
- (id <DBResultSet>) getResultSet
{
	return self->result;
}

- (int) getAffectedRows
{
	return 0;
}

//==============================================================================
// Error Methods
//==============================================================================

- (NSString*) getErrorMessage
{
	return self->errorMessage;
}

// Setters and Getters

// Getter methods
- (NSString*) getQuery
{
	return self->query;
}

- (void) setQuery: (NSString*) sql
{
	self->query = sql;
}

- (void) close
{
	
}
@end
